package com.demo.BeanFactoryPostProcessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory factory) throws BeansException {
        System.out.println("MyBeanFactoryPostProcessor 的 postProcessBeanFactory 方法！");
        BeanDefinition monky = factory.getBeanDefinition("monkey");
        MutablePropertyValues propertyValues = monky.getPropertyValues();
        propertyValues.add("name", "wpz521");
    }
}
